/**
 * 
 */
package com.jintian.smart.kernel.common.expr.op.define;

import com.jintian.smart.kernel.core.expr.IllegalExpressionException;
import com.jintian.smart.kernel.common.expr.datameta.BaseDataMeta;
import com.jintian.smart.kernel.common.expr.datameta.Constant;
import com.jintian.smart.kernel.common.expr.op.Operator;

/**
 * 逻辑与操作
 * 
 */
public class Op_AND extends Op_Base {

	public Op_AND() {
		super(Operator.AND);
	}

	public Constant execute(Constant[] args) throws IllegalExpressionException {
		Object[] params = this.getParameterValues(args);
		if ((Boolean) params[0]) {
			return new Constant(BaseDataMeta.DataType.DATATYPE_BOOLEAN, (Boolean) params[1]);
		} else {
			return new Constant(BaseDataMeta.DataType.DATATYPE_BOOLEAN, false);
		}
	}

	public Constant verify(int opPositin, BaseDataMeta[] args) throws IllegalExpressionException {
		this.checkParameterCount(opPositin, args);
		return new Constant(BaseDataMeta.DataType.DATATYPE_BOOLEAN, Boolean.FALSE);

	}

}
